package com.hr.JVM字节码;

/**
 * @program: leetcode
 * @description: 成员变量（非静态的赋值过程）1.默认初始化 2.显示初始化、代码块中初始化 3 构造器中初始化 4 有了对象之后，对成员变量进行赋值
 * @author: HuRan QQ1345122890
 * @create: 2021-05-16 11:53
 */
public class SonTest {
    public static void main(String[] args) {
        Father f=new Son();
       System.out.println(f.x);
    }
}

class Father {
    int x = 10;

    public Father() {
        this.print();
        x = 20;
    }

    public void print() {
        System.out.println("Father.x=" + x);
    }
}

class Son extends Father {
    int x = 30;

    public Son() {
        this.print();
        x = 40;
    }
    @Override
    public void print() {
        System.out.println("Son.x=" + x);
    }
}